<script>
$(document).ready(function(){ 
   
    $("#dialog").dialog({ title: '<?=ucfirst($this->actionName) .' '.ucfirst($this->controllerName)?> ' });
    
    $( "#ajax_form input[name=modelo]" ).ajaxComplete('/racks-activos','modelo','/idZona/<?=$this->idZona?>');
    $( "#ajax_form input[name=marca]" ).ajaxComplete('/racks-activos','marca','/idZona/<?=$this->idZona?>');
    $( "#ajax_form input[name=departamento]" ).ajaxComplete('/racks-activos','departamento','/idZona/<?=$this->idZona?>');
    $( "#ajax_form input[name=uso]" ).ajaxComplete('/racks-activos','uso','/idZona/<?=$this->idZona?>');



    $( "#ajax_form input[name=modelo]" ).change(function () {
        setTimeout("getModelo()",100)
	})
    

})


function getModelo(){
     modelo = $( "#ajax_form input[name=modelo]" ).val();
     
     $.post('/racks-activos/modelo', {modelo: modelo,idZona: <?=$this->idZona?>},function(data){
        $("#ajax_form select[name=tipo_activo] option[value='"+data.tipo_activo+"']").attr("selected", true);
        $( "#ajax_form input[name=num_u]" ).val(data.num_u);
        $( "#ajax_form input[name=potencia_maxima]" ).val(data.potencia_maxima);
        $( "#ajax_form input[name=uso]" ).val(data.uso);
        $( "#ajax_form input[name=marca]" ).val(data.marca);
     });
    
}
</script>


<?php
$this->form->setAction($this->url())->setAttrib('id', 'ajax_form');


echo $this->form;



echo $this->partial('form_js.phtml', 
    array(	
        'actionName'=>$this->actionName,
        'id'=>$this->id,
        'id_tablesorter'=>$this->id_tablesorter,
        )
);

?>
<div class="ayuda">
<blockquote>
<?=$this->form->getDescription()?>
</blockquote>
</div>


